package com.ktjiaoyu.yuanzihuan.repository;


import com.ktjiaoyu.yuanzihuan.bean.IndexImg;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
public class IndexImgRepositoryTester {

    @Resource
    private IndexImgRepository indexImgRepository;


    @Test
    public void testGetId() {//测试按主键查询
        IndexImg indexImg = indexImgRepository.findById(1L).get();
        System.out.println("usrName：" + indexImg.getImgName());
    }


    @Test
    public void testGet() {
        //List<IndexImg> list = indexImgRepository.findAll();
        List<IndexImg> list = indexImgRepository.findByEnabledAndImgTypeOrderByImgOrderAsc(1,"top");
        System.out.println(list.size());
    }

}
